import axios from 'axios';

async function searchQcc() {
  try {
    const response = await axios.post(
      'https://www.qcc.com/api/search/searchMulti',
      {
        'searchKey': '东软',
        'pageIndex': 2,
        'pageSize': 20
      },
      {
        headers: {
          'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6',
          'cache-control': 'no-cache',
          'e189d6382c04b1236b13': 'dd8d6ce3afdd57b307b39047a29f697a3e8125c720c8476caa97bfc2e39c9269bfa9fd178eac18fd88a398860ce0bf56b0cdc4d01f30d5aca8731adfec99ca85',
          'origin': 'https://www.qcc.com',
          'referer': 'https://www.qcc.com/web/search?key=东软',
          'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36 Edg/135.0.0.0',
          'cookie': 'QCCSESSID=8a4a2b5be134d72b522a664a36; qcc_did=753e8ea2-da8a-4847-900a-1c71d5690342; acw_tc=1a0c39d317454991329231408e0069f1cfa09cf15bbe58778b13d66fd5d550'
        }
      }
    );
    console.log(response.data);
    return response.data;
  } catch (error) {
    console.error('请求失败:', error.response?.data || error.message);
    throw error;
  }
}

// 调用函数
searchQcc().then(data => {
  console.log('请求成功:', data);
}).catch(err => {
  console.error('请求处理失败:', err);
});